<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\Base;

class GoodsServer extends Base
{

    public array $scenes = [
        'v1.create' => 'title,thumb,integral',
        'v1.list' => 'noPage,pageSize',
        'v1.detail' => 'id',
        'v1.modify' => 'id,title,thumb,integral',
        'v1.delete' => 'id',
    ];


    public function rules(): array
    {
        return [
            'id' => 'bail|required',
            'title' => 'bail|required|string',
            'integral' => 'bail|required',
            'thumb' => 'bail|required',
            'state' => 'bail|required|int|in:0,1,2',

            'noPage' => 'bail|nullable|min:1|numeric',
            'pageSize' => 'bail|nullable|min:1|numeric',

        ];
    }


    public function messages(): array
    {
        return [

            'id.required' => 'id不能为空',
            'title.required' => '名字不能为空',
            'title.string' => '名字不正确',
            'integral.required' => '米米不能为空',
            'thumb.required' => '头像不能为空',
            'state.required' => '状态不能为空',
            'state.in' => '状态值不支持',
            'noPage.min' => '页码不能小于1',
            'noPage.numeric' => '页码格式非法',
            'pageSize.min' => '查询条数不能小于1',
            'pageSize.numeric' => '查询条数格式非法',


        ];
    }

}
